
//	------------------------------------------------------------------------------
//                                       _                          
//              _ __ ___   ___ _ __ ___ | |__  _ __ __ _ _ __   ___ 
//             | '_ ` _ \ / _ \ '_ ` _ \| '_ \| '__/ _` | '_ \ / _ \
//             | | | | | |  __/ | | | | | |_) | | | (_| | | | |  __/
//             |_| |_| |_|\___|_| |_| |_|_.__/|_|  \__,_|_| |_|\___|
//                                                     
//	------------------------------------------------------------------------------

#region - License -
//
//	------------------------------------------------------------------------------                                                   
//	         Copyright (c) 2010 Peter Vyvey (peter.vyvey@chiliware.be)
//	------------------------------------------------------------------------------
//
//
//	This file is part of CHILIWARE MEMBRANE.
//
//	CHILIWARE MEMBRANE is free software: you can redistribute it and/or modify
//	it under the terms of the GNU Lesser General Public License as published by
//	the Free Software Foundation, either version 3 of the License, or
//	(at your option) any later version.
//
//	CHILIWARE MEMBRANE is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRANTY; without even the implied warranty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//	GNU Lesser General Public License for more details.
//
//	You should have received a copy of the GNU Lesser General Public License
//	along with CHILIWARE MEMBRANE.  If not, see <http://www.gnu.org/licenses/>.
//
//
#endregion

#region - Changes -
//
//	peter.vyvey@chiliware.be		2010-08-09		Created
//
#endregion

#region - Using -

using System.Configuration;

#endregion

namespace Chiliware.Membrane.Configuration
{
	#region - Preloaders -

	/// <summary>
	/// The collection of preloader configuration section.
	/// </summary>
    public sealed class Preloaders : ConfigurationElementCollection
    {
        #region - Properties -

		/// <summary>
		/// Indexer property returning the <see cref="Preloader"/> configuration at the given index.
		/// </summary>
		/// <param name="index">The index.</param>
		/// <returns>The <see cref="Preloader"/> configuration.</returns>
        public Preloader this[int index]
        {
            get { return (Preloader)base.BaseGet(index); }
        }

		/// <summary>
		/// Indexer property returning the <see cref="Preloader"/> configuration at the given index.
		/// </summary>
		/// <param name="index">The index.</param>
		/// <returns>The <see cref="Preloader"/> configuration.</returns>
		public new Preloader this[string index]
		{
			get { return (Preloader)base.BaseGet(index); }
		}

		/// <summary>
		/// Returns the configuration collection type.
		/// </summary>
        public override ConfigurationElementCollectionType CollectionType
        {
            get { return ConfigurationElementCollectionType.BasicMap; }
        }

		/// <summary>
		/// Identifier for the element configuration.
		/// </summary>
        protected override string ElementName
        {
            get { return "preloader"; }
        }

        #endregion

		#region - Constants & static fields -



		#endregion

		#region - Private & protected methods -

		/// <summary>
		/// Creates a new element.
		/// </summary>
		/// <returns></returns>
        protected override ConfigurationElement CreateNewElement()
        {
            return new Preloader();
        }

		/// <summary>
		/// Gets the element key.
		/// </summary>
		/// <param name="element">The configurationn elemen.</param>
		/// <returns>The key.</returns>
        protected override object GetElementKey(ConfigurationElement element)
        {
            return ((Preloader)element).Type;
        }

        #endregion

        #region - Public methods -

		/// <summary>
		/// Clears the collection of <see cref="Preloader"/>.
		/// </summary>
        public void Clear()
        {
            this.BaseClear();
        }

		/// <summary>
		/// Adds a <see cref="Preloader"/> the configuration.
		/// </summary>
		/// <param name="element">The preloader configuration.</param>
        public void Add(Preloader element)
        {
            if (element != null)
            {
                this.BaseAdd(element);
            }
        }

		/// <summary>
		/// Removes the <see cref="Preloader"/> with the given name from the collection.
		/// </summary>
		/// <param name="name"></param>
        public void Remove(string name)
        {
            this.BaseRemove(name);
        }

        #endregion
    }

    #endregion
}
